import { defHttp } from '@/utils/http/axios';
import { ErrorMessageMode } from '#/axios';

export interface DeployParams {
  endpoints: string[];
}

export interface GetDeployRequestResponse {
  pending: number;
  unread: number;
}

export function deploy(params: DeployParams, mode: ErrorMessageMode = 'message') {
  return defHttp.post(
    {
      url: `/system/deploy`,
      params
    },
    {
      errorMessageMode: mode,
    }
  );
}

export function getDeployRequest(mode: ErrorMessageMode = 'message') {
  return defHttp.get<GetDeployRequestResponse>(
    {
      url: `/system/deploy/requests`,
    },
    {
      errorMessageMode: mode,
    }
  );
}